<template>
    <div class="mui-numbox" data-numbox-min="1">
        <button class="mui-btn mui-btn-numbox-minus" type="button">-</button>
        <input class="mui-input-numbox" type="number" @change="numChange()" ref="num" :value="initNum" :id="goodsId" readonly/>
        <button class="mui-btn mui-btn-numbox-plus" type="button">+</button>
    </div>
</template>

<script type="text/ecmascript-6">
    import mui from "../../lib/mui/js/mui.min.js";

    export default {
        mounted(){
            mui(".mui-numbox").numbox()
        },
        methods:{

            numChange(){
                this.$store.commit('updateList',{
                    id: this.goodsId,
                    count: this.$refs.num.value
                })
            }
        },
        props:['goodsId','initNum'],
    };

</script>

<style lang="stylus" rel="stylesheet/stylus">

</style>